import cherrypy
import sha
from django.utils import simplejson

from app.models import PayDetails, Benefit
from app.controllers.benefit import BenefitController
from app.controllers.payroll import PayrollController
from app.controllers.employee import EmployeeController
from app.dutil import toClass

from google.appengine.ext import db

class PayrollHandler:
	@cherrypy.expose
	def index(self):
		pass
		
	@cherrypy.expose
	def details(self, id):
		rsPayDetails = PayrollController.getPayrollsByEmployee(int(id))#employeeId
		dPayDetails = [rPayDetails.toRows() for rPayDetails in rsPayDetails]
		return simplejson.dumps(max(dPayDetails))#get last record
		